import java.util.Scanner;

public class Day28 {
    public static void main(String[] args) {

    }

    // 定义结点
    static class Node {
        public Node(int val) {
            this.val = val;
        }

        public Node() {
        }

        int val;
        Node next;
    }

    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            // 构造链表
            int n = in.nextInt();
            Node preHead = new Node();
            Node last = new Node();
            for (int i = 0; i < n; i++) {
                Node node = new Node(in.nextInt());
                last.next = node;
                last = node;
                if (i == 0) {
                    preHead.next = last;
                }
            }
            int start = in.nextInt();
            int end = in.nextInt();
            int sub = end - start;

            Node res = preHead;
            // 头插法逆转
            while (start - 1 != 0) {
                preHead = preHead.next;
                start--;
            }
            // 反转
            Node s = preHead.next;
            while (sub != 0) {

                Node tmp = s.next.next;
                s.next.next = preHead.next;
                preHead.next = s.next;
                s.next = tmp;
                sub--;
            }

            while (res.next != null) {
                System.out.print(res.next.val + " ");
                res = res.next;
            }
        }
    }
}
